package com.fitness.fitness.kafka;

import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
@RequiredArgsConstructor
public class ADSKafkaListener {

    @Resource
    private ADSMsgResolver adsMsgResolver;

    @KafkaListener(topics = "adsTopic", groupId = "adsGroup")
    public void listen(String message) {
        if(StrUtil.isBlank(message)){
            log.warn("no message!!!");
            return;
        }

        log.info("input value: {}" , message);

        adsMsgResolver.resolve(message);
    }
}
